#include	<ctype.h>
#include	<stdlib.h>
#include	<stdio.h>

int
aatoi(register const char * s)
{
	register int	a;
	register unsigned char	sign;

	while(*s == ' ' || *s == '\t')
		s++;
	a = 0;
	sign = 0;
	if(*s == '-') {
		sign++;
		s++;
	} else if(*s == '+')
		s++;
	while(isdigit(*s))
		a = a*10 + (*s++ - '0');
	if(sign)
		return -a;
	return a;
}

static int _atoi(char *s)
{
    int k = 0;
    
    k = 0;
    while (*s != '\0' && *s >= '0' && *s <= '9') 
    {
        k = 10 * k + (*s - '0');
        s++;
    }
    return k;
}

void main()
{
	char test[3] = {'1','2','3'};
	int ret;

	ret = _atoi(test);
	printf("_atoi after ret is %d\n", ret);
}